Skip to content

New HTML to split log and command entry to fix issue #804.#835

Closed
agadsby wants to merge 7 commits into
SDL-Hercules-390:developfrom
agadsby:patch-1
Closed

New HTML to split log and command entry to fix issue #804.#835
agadsby wants to merge 7 commits into
SDL-Hercules-390:developfrom
agadsby:patch-1

Conversation

@agadsby

@agadsby agadsby commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Uses JavaScript for separate command entry via cmd.html (new frame in hercules.html) and asynchronous pooling syslog viewer using updated JSON API so only changed lines are pulled on each refresh.

Command line recall and log scrolling is supported

@Fish-Git Fish-Git left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to work!  :(

Well, it WORKS, yes, but it doesn't seem to fix the problem as described in GitHub Issue #804!!

Yes, it can refresh the log display to show the new lines, and yes, it rejects an auto-refresh interval of 0 (zero), but all of the buttons and input fields are all at the bottom of the page/screen!

When the number of lines is set to '0' (zero) (in order to display the complete log) and the autor-efresh interval is set to 1 (the new minimal allowed), the log display refreshs so frequently (so quickly!) that you can't reach the buttons and thier input fields at the botton of the page to set a slower refresh rate or shorter/smaller #of log lines!

It's basically the same bug that GitHub Issue #804 described!

I thought you were going to move the buttons and input fields currently at the bottom of the screen/page to the TOP of the page/screen to fix the described problem! Yes? I seem to recall that you actually did do that at one point in the recent past. Yes?

Or was I halllucinating?

@Fish-Git

Fish-Git commented Apr 30, 2026

Copy link
Copy Markdown
Member

@Fish-Git from your description your browser has cached the old pages.

(DOH!) You're probably right. Let me clear my cache and try again...

It works fine now! (Sorry about that! My bad!)

Two questions however before accepting this Pull Request:

  1. Is there a way in HTTP to request that the browser ignore its cache and do a fresh load/re-load/fetch of the file each time? If not, that's fine. I just thought I'd ask. (Yes, doing so would impact performance, but the impact would be negligible IMO)

  2. I noticed the Hercules command line is still at the bottom of the page. Is there any chance of moving it to the top of the page along with everything else? Or is this not really an issue anymore since it's now in a separate frame, and thus, due to the new design, immune to any high refesh rate?

#2 is the only one I'm really interested in having answered before accepting/merging your PR. #1 is just a curiosity. It would really be nice to have if possible for idiots like me who forget to clear their browser cache.

Thanks!

@agadsby

agadsby commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

I'm not aware of a way of fixing the cache issue as it's due to the Hercules HTTP server being very simple (brain dead).

On the command line it's trivial. In html/hercules.html swap the cmd and main "frame" lines around and on

rows="95,*,100" swap the * and 100 around to rebalance the rows.

  • the reason I didn't do it is that the output is at the bottom of the main screen , like a 3270, and it felt odd typing at the top. Try swapping those two lines and see what you think?

It's truly trivial to rework any of the layout now- so let's get it right before you accept the PR

@Fish-Git

Fish-Git commented Apr 30, 2026

Copy link
Copy Markdown
Member
  • the reason I didn't do it is that the output is at the bottom of the main screen , like a 3270, and it felt odd typing at the top.

Interesting. I've always preferred having the command line at the top of my 3270 terminals, so a quick Ctrl+Home, while editing the file, would immediately position my cursor to the beginning of the command line.

Is there maybe a simple boolean [x] checkbox toggle we could introduce to make that setting customizable to user preference?

And while I'm on the subject, I'm now wondering if a user's preferences (or previously used values?) could maybe be preserved/saved somewhere? I'm thinking maybe a new http opts(?) configuration file statement to accompany our existing http port and http root statements? But that sounds like something maybe I should probably look into doing myself, not anything for you to do, so forget I even mentioned it.  :)

Oh! One other minor(?) cosmetic thing I forget to ask you about: I like the ability to set Dark/Light mode, but it seems to only affect (apply to) the log display. Shouldn't it affect the entire screen/page? (VERY LOW priority / optional! If it would take too much effort on your part, then forget it!)

Try swapping those two lines and see what you think?

Will give it a go and get back to you.

Thanks for everything you've done so far, Andy! Our HTTP Server screen is looking much better now! THANK YOU!!

@agadsby

agadsby commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

I can easily build in a top/bottom button in the cmd window to allow a user to switch it over. This would also have persistence just like the current theme, refresh and command history - this is held at the browser so the user retains their settings between sessions on that browser.

Give me a couple of days - don't accept this PR as I'll change some of the files.

Back to the caching. A simple fix to httpserve to add an ETAG and handle the headers required would fix that.

I think it's worth doing, otherwise when we switch the UI people may get confused - let me work on this. I'll do a separate PR for this change.

@Fish-Git

Fish-Git commented May 2, 2026

Copy link
Copy Markdown
Member

I'm not aware of a way of fixing the cache issue as it's due to the Hercules HTTP server being very simple (brain dead).

How much effort would it take (and how much complication would it introduce) to make it not so brain dead? If it would take more effort than it's its worth (or make our server HTTP code more complicated and fragile than its worth) then of course forget it.   (KISS, right?)

On the command line it's trivial. In html/hercules.html swap the cmd and main "frame" lines around and on

rows="95,*,100" swap the * and 100 around to rebalance the rows.

Thanks! I just tried it and I like it! But then that's just me too. Others may like it at the bottom like you. So if you can do the top/bottom button thing, great! Otherwise just leave it as is.

Give me a couple of days - don't accept this PR as I'll change some of the files.

10-4.

let me work on this. I'll do a separate PR for this change.

10-4.

@agadsby

agadsby commented May 2, 2026

Copy link
Copy Markdown
Contributor Author

I can fix the caching code in httpserv cleanly, and easily, but due to the legacy cache expiry time header used it won't invalidate the old browser copy immediately because the browser won't even ask the server until the cache time expires.

However, we should fix it now as it'll save pain next time.

Working on it now....

@agadsby

agadsby commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

@Fish-Git This is not directly related to this PR but whilst doing a mini regression test I discovered what may be another --noui issue. Could you try this on your windows build on the master (as shipping version).?

Start in --noui with stdin from the nul device. Start the original HTTP console and then select "Version Info" in the left hand tasks window.

On my LINUX build (both develop and master) it prints the "Hercules Version Information" and Hercules simply dies - no message no nothing.......

@gottfriedleibniz

gottfriedleibniz commented May 3, 2026

Copy link
Copy Markdown

On my LINUX build (both develop and master) it prints the "Hercules Version Information" and Hercules simply dies - no message no nothing.......

Took a look at this and looks related to when the socket is assigned handle 0 (which is technically valid, since script.c closes stdin). Updating the httpfd check in display_str to use httpfd >= 0 prevents the crash on my end:

if (httpfd)

(Note: I have not checked the rest of the code to see whether this logic appears elsewhere1)

Footnotes

  1. For instance, thinking about cb_ptr->sock <= 0.

@Fish-Git

Fish-Git commented May 3, 2026

Copy link
Copy Markdown
Member

Start in --noui with stdin from the nul device. Start the original HTTP console and then select "Version Info" in the left hand tasks window.

When I start hercules with --noui and stdin redirected from the nul device, after processing its configuration and script files, Hercules immediately quits and exits, giving me zero opportunity to even try to connect to the HTTP Server!

hyperion/impl.c

Lines 1832 to 1849 in ee86c4d

quit_cmd( 0, 0, 0); /* normal/clean shutdown */
}
}
/*
** PROGRAMMING NOTE: the following code is only ever reached
** if Hercules is run in normal panel mode -OR- when it is run
** under the control of an external GUI (i.e. noui_task).
*/
ASSERT( sysblk.shutdown ); // (why else would we be here?!)
#ifdef _MSVC_
SetConsoleCtrlHandler( console_ctrl_handler, FALSE );
socket_deinit();
#endif
fflush( stdout );
USLEEP( 10000 );
return 0; /* return back to bootstrap.c */

This was one of the things I fixed with commit 9617672.

@agadsby

agadsby commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

@gottfriedleibniz thank you for looking at this. I will plug your suggestion in and give it a go. It certainly sounds like a probable cause of what I am seeing.

@Fish-Git in my case I had an os (tried with vm and mvs) running and when I went to the HTTP console and clicked "version information" - bang, all gone.

@Fish-Git

Fish-Git commented May 3, 2026

Copy link
Copy Markdown
Member

@Fish-Git in my case I had an os (tried with vm and mvs) running and when I went to the HTTP console and clicked "version information" - bang, all gone.

But how did you even manage to get any os running in the first place?! As I said, starting hercules (current 4.9.1 master branch) with the --NoUI option and with no stdin (< NUL), Hercules immediately exits/quits after initializing! So how did you manage to IPL a guest o/s and get it running?! How did you manage to connect to the HTTP Server? You can't connect to the HTTP Server if Hercules isn't up and running!

@agadsby

agadsby commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Hercules.rc

So for VM370

  • Hercules runs the commands in this file upon startup.

  • IPL VM/370, which resides on device 6A1.
    pause 2
    ipl 6A1

  • Enable any attached devices.
    pause 4
    /enable all

@agadsby

agadsby commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

@gottfriedleibniz yes that's fixed that issue.

I wonder if something similar explains why when running in --noui, stdin must be redirected to nul otherwise it still tries to read from the controlling terminal.

@Fish-Git

Fish-Git commented May 4, 2026

Copy link
Copy Markdown
Member

Hercules.rc

Ah. Yes of course. I'll give that a try and report back.

@Fish-Git

Fish-Git commented May 4, 2026

Copy link
Copy Markdown
Member

I'll give that a try and report back.

Seems to work fine for me! I click the "Version" link in the "Tasks" column and it displays the version information, and Hercules keeps on chugging along just fine. The --noui issue you described does not occur for me.

@Fish-Git

Fish-Git commented May 4, 2026

Copy link
Copy Markdown
Member

@agadsby,

P.S. Don't forget to let me know when this PR is ready for merging!1

Footnotes

  1. > Give me a couple of days - don't accept this PR as I'll change some of the files.

@agadsby

agadsby commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

@Fish-Git

P.S. Don't forget to let me know when this PR is ready for merging1

It's funny how an apparently simple change - move the command window - can have such wide implications. Anyway, I've reworked things and have a version ready for a new PR. It's extensive changes on the last one so I'll raise a brand new PR and then delete the previous one.

The good news is that it's further simplified the html logic, albeit with everything UI there is always trivial complexity to make things feel right.

I'm going for a walk to make sure I don't think of any extra "features" aka bugs and will do the PR later today (UK time).

Andy

@agadsby agadsby closed this May 6, 2026
@agadsby agadsby deleted the patch-1 branch May 6, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants